<?php
include('database.php');
$orderCount = 0;
if(isset($_POST['orderCount'])){
    $orderCount = $orderCount + $_POST['orderCount'];
}

$i=0;
foreach($_POST as $value){
    $items[$i] = $value;
    $i++;
}

$j=0;
foreach($items as $info){
    $itemInfo[$j] = explode('_', $info);
    $strFunc = '';
    $k=0;
    foreach($itemInfo[$j] as $item){
        if($k==0){
            $str1 = $item;
        }
        elseif($k==1){
            $str2 = $item; 
        }
        else{
            $str3 = $item;
        }
        $k++;
    }
    //echo $str1.", ".$str2.", ".$str3."<br />";
    $database->createLogFromOrder($str1, $str2, $str3);
    $j++;
}
$orderCount = $orderCount+1;
header('Location: index.php?orderCount='.$orderCount);
?>
